<script setup lang="ts">
import { onMounted, useTemplateRef } from 'vue';
import * as echarts from 'echarts';

const homeViewRef = useTemplateRef<HTMLDivElement>('left-top');

const render = () => {
    const chart = echarts.init(homeViewRef.value!);

    chart.setOption({
        xAxis: {
            type: 'category',
            data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
        },
        yAxis: {
            type: 'value',
        },
        series: [
            {
                type: 'line',
                data: [150, 230, 224, 218, 135, 147, 260],
            },
            {
                type: 'line',
                data: [150, 330, 124, 218, 135, 14, 260],
            },
        ],
    });

    window.addEventListener('resize', () => chart.resize());
};

onMounted(render);
</script>

<template>
    <div class="left-top" ref="left-top" />
</template>

<style scoped lang="scss"></style>
